package com.mdd.admin.service.sign;

import com.alipay.api.AlipayApiException;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mdd.common.entity.agreement.AlipaySignUserAgreementRecord;

/**
* @author DELL
* @description 针对表【alipay_sign_user_agreement_record(授权记录)】的数据库操作Service
* @createDate 2023-11-01 17:23:12
*/
public interface AlipaySignUserAgreementRecordService extends IService<AlipaySignUserAgreementRecord> {

    AlipaySignUserAgreementRecord getRecordByOrderId(String orderId);
    AlipaySignUserAgreementRecord getRecordByUserId(Long userId);
    AlipaySignUserAgreementRecord getRecordByAgreementNo(String agreementNo);
    AlipaySignUserAgreementRecord updateRecordByAlipayUserId(String alipayUserId,String agreementNo);

    /**
     * 解约
     * @param agreementNo
     * @return
     */
    AlipaySignUserAgreementRecord cancelRecordByAlipayUserId(String agreementNo);

    /**
     * 异步解约
     * @param agreementNo
     * @return
     * @throws AlipayApiException
     */
    AlipaySignUserAgreementRecord applyCancelRecordByAlipayUserId(String agreementNo) throws AlipayApiException;

    /**
     * 签约完成回调
     * @param alipaySignUserAgreementRecord
     */
    void finalSign(AlipaySignUserAgreementRecord alipaySignUserAgreementRecord);

    /**
     * 强制取消签约
     * @param orderId
     * @return
     * @throws AlipayApiException
     */
    AlipaySignUserAgreementRecord cancelRecordByOrderId(Long orderId) throws AlipayApiException;
}
